import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;


public class LoginPanel extends JPanel{
	//JFrame frame=new JFrame("User Login");
	JLabel username=new JLabel("Username: ");
	JLabel password=new JLabel("Password: ");
	JTextField usertext=new JTextField(10);
	//JTextField passwordtext=new JTextField(10);
	JPasswordField passwordtext=new JPasswordField(10);
	JButton loginButton=new JButton("Login");
	JPanel panel=new JPanel();
	char[] pin=passwordtext.getPassword();//hide password
	
	public LoginPanel() {
		panel.setPreferredSize(new Dimension(600,400));
		//panel.setLayout(null);
		panel.add(username);
		panel.add(usertext);
		panel.add(password);
		panel.add(passwordtext);
		panel.add(loginButton);
		
		
		add(panel);
		
		passwordtext.addActionListener(new actionListener());//when you press enter, it'll jump to menu page
		loginButton.addActionListener(new actionListener()); //when you push the button, jump to menu page
		
	}
	
	private class actionListener implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent arg0) {
			remove(panel);
			add(new MenuPanel());
			validate();
			repaint();
		}
	}
}
